// _Test5_Effects.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "cv.h"
#include "highgui.h"

IplImage* doPyrDown(IplImage* in, int filter = IPL_GAUSSIAN_5x5 )
{
	assert( in->width % 2 == 0 && in->height % 2 ==0 );
	IplImage* out = cvCreateImage(cvSize(in->width/2,in->height/2),in->depth,in->nChannels);
	cvPyrDown(in,out,filter);
	return(out);
}

IplImage* doCanny(IplImage* in, double lowThresh, double highThresh, int aperture)
{
	if(in->nChannels != 1)
		return(0);
	IplImage* out = cvCreateImage(cvGetSize(in),IPL_DEPTH_8U,1);
	cvCanny(in,out,lowThresh,highThresh,aperture);
	return(out);
}

int _tmain(int argc, _TCHAR* argv[])
{

	cvNamedWindow("Example5A");
	cvNamedWindow("Example5B");
	IplImage* in = cvLoadImage("D:\\Leaves.jpg");
	IplImage* out = doPyrDown(in,IPL_GAUSSIAN_5x5);
	//	IplImage* img2 = doPyrDown(img1,IPL_GAUSSIAN_5x5);
	//	IplImage* out = doCanny(in,10,100,3);
	//	IplImage *out = cvCreateImage(cvSize(in->width,in->height),IPL_DEPTH_8U,3);
	cvShowImage("Example5A",in);
	cvShowImage("Example5B",out);
	cvWaitKey(0);



	cvReleaseImage(&out);
	//	cvReleaseImage(&img1);
	//	cvReleaseImage(&img2);
	cvReleaseImage(&in);
	cvDestroyWindow("Example5A");
	cvDestroyWindow("Example5B");

	return 0;
}

